package com.quwan.common.enums;

/**
 * @author lt
 * @Date 2022/1/5 11:09 上午
 */
public enum LabelEnum {
    Normal("Normal", new Byte((byte)1)),// 正常
    Porn("Porn", new Byte((byte)2)),// 色情
    Abuse("Abuse", new Byte((byte)3)),// 谩骂
    Ad("Ad", new Byte((byte)4)),// 广告
    Custom("Custom", new Byte((byte)5));// 自定义违规

    private String msg;
    private Byte code;

    private LabelEnum(String msg, Byte code) {
        this.msg = msg;
        this.code = code;
    }
    public static String getMsgByCode(Byte code){
        LabelEnum[] enums = LabelEnum.values();
        for (LabelEnum labelEnum :enums){
            if(labelEnum.getCode().equals(code)){
                return labelEnum.getMsg();
            }
        }
        return "";
    }

    public static boolean isValidCode(Byte code) {
        for (LabelEnum labelEnum : LabelEnum.values()) {
            if (code.equals(labelEnum.getCode())) {
                return true;
            }
        }
        return false;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Byte getCode() {
        return code;
    }

    public void setCode(Byte code) {
        this.code = code;
    }
}
